// JavaScript Document
$().ready(function() {
$("#eform-node-form").validate({
										
										 
					rules: {
						'field_eform_existyes[und]':{
							required:'#edit-field-eform-existform-und-yes:checked',
							valuenotequals: '_none',
						},
						'field_eform_dept[und]': { 
							required: true,
						},
						'field_eform_organisation[und]': { 
							required: true,
							valuenotequals: '_none',
						},
						'field_eform_dist[und][]':{
							//required: true,
							//maxlength: 255,
							//chkbadchar:true,
							multi_dist_select: true,
							},
							'field_eform_category[und]' :{
							valuenotequals: '_none',	
							},
							'field_eform_keywords[und][0][value]':{
							required: true,
							},
							'field_eform_formno[und][0][value]': { 
							required: true,
							},
							'field_eform_assoc[und]':{
							required:true,
							},
							'field_eform_services[und]':{
							valuenotequals: '_none',
							},
							'field_eform_scheme[und]':{
							valuenotequals: '_none',
							},
							'field_eform_other[und][0][value]':{
							required:'#edit-field-eform-assoc-und',
							},
							'field_eform_desc[und][0][value]':{
							required:true,
							},
							'field_eform_othercategory[und][0][value]':{
							required:true,
							},
							'title':{
							required:true,
							},
							
						
					
					},
                    messages: {
							'field_eform_existyes[und]':{
							required:'Please Select Form',
							valuenotequals:'Select form name',
							},
							'field_eform_dept[und]':{
							required: 'Please Select Concerned Department',
							},
							'field_eform_organisation[und]':{
							required: 'Please Select Organization',
							valuenotequals: 'Select Organization Name',
							},
							'field_eform_dist[und][]':{
							required: 'Please Select Districts',
							multi_dist_select: 'Please Select either All or Particular Districts',
							},
							'title': { 
							required:  'Please enter Title',
							},
							'field_eform_keywords[und][0][value]':{
							required: 'Please enter Keywords',	
						    },
							'field_eform_formno[und][0][value]':{
							required: 'Please enter Form No',	
							},
							'field_eform_assoc[und]':{
							required: 'Please Select Associated Services/Schemes',	
							},
							'field_eform_services[und]':{
							valuenotequals: 'Please Select list of services',
							},
							'field_eform_scheme[und]' :{
							valuenotequals: 'Please Select list of schemes',
							},
							'field_eform_other[und][0][value]' :{
							required:  'Please enter Other Asoociated Service/Scheme',	
							},
							'field_eform_desc[und][0][value]' :{
							required:'Please enter Description',	
							},
							'field_eform_othercategory[und][0][value]':{
							required:  'Please enter Other Category',
							},
							'field_eform_category[und]':{
							valuenotequals: 'Please Select the Category',	
							},
							
							
				}, 
					//errorLabelContainer: "#errormsg_container",
					 //focusInvalid: false,
   					invalidHandler: function(form, validator) {
       
       					 if (!validator.numberOfInvalids())
								return;
						else{
							
							  //$("#announcements-node-form").create_errormsg_container('errormsg_container','announcements-node-form');
						}
							
							$('html, body').animate({
								scrollTop: $(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
						},
				

   
	});


            
});
